package com.hzy.springboot_register;

import cn.itcast.pojo.Country;
import com.hzy.anno.EnableCommonConfig;
import com.hzy.config.CommonConfig;
import com.hzy.config.CommonImportSelector;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;

@SpringBootApplication
//@Import({CommonConfig.class})
//@Import(CommonImportSelector.class)
@EnableCommonConfig
public class SpringbootRegisterApplication {

    public static void main(String[] args) {
        ApplicationContext context =  SpringApplication.run(SpringbootRegisterApplication.class, args);

        Country country = context.getBean(Country.class);
        System.out.println(country);
        System.out.println(context.getBean("province"));
    }

    //注入country对象
    //启动类不建议
//    @Bean
//    public Country country(){
//        return new Country();
//    }
}
